local skel = fk.CreateSkill {
  name = "role_exmode_mingtu__lb_xie",
}

Fk:loadTranslationTable {
  ["role_exmode_mingtu__lb_xie"] = "谐",
  [":role_exmode_mingtu__lb_xie"] = "每回合限一次，当你受到伤害后，你可以摸一张牌并分配一张牌。",
  ["#role_exmode_mingtu__lb_xie"] = "谐：你可以摸一张牌并分配一张牌",
  ["#role_exmode_mingtu__lb_xie-give"] = "谐：你可以将一张牌交给其他角色",
}

skel:addEffect(fk.Damaged, {
  can_trigger = function (self, event, target, player, data)
    return player:hasSkill(skel.name) and target == player and player:usedSkillTimes(skel.name, Player.HistoryTurn) == 0
  end,
  on_cost = function (self, event, target, player, data)
    return player.room:askToSkillInvoke(player, {skill_name = skel.name, prompt = "#role_exmode_mingtu__lb_xie" })
  end,
  on_use = function (self, event, target, player, data)
    local room = player.room
    player:drawCards(1, skel.name)
    if #player:getCardIds("he") > 0 then
      local tos, cards = room:askToChooseCardsAndPlayers(player, {
        min_num = 1,
        max_num = 1,
        min_card_num = 1,
        max_card_num = 1,
        targets = room:getOtherPlayers(player),
        pattern = ".",
        skill_name = skel.name,
        prompt = "#role_exmode_mingtu__lb_xie-give",
        cancelable = true,
      })
      if #tos > 0 and #cards > 0 then
        room:moveCardTo(cards, Card.PlayerHand, tos[1], fk.ReasonGive, skel.name, nil, false, player)
      end
    end
  end,
})

return skel